package com.zking.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;

/**
 * Created by OWen on 2023-2023/11/27, project: springboot1206.
 * <p>
 * Author: OWen
 * Create Date: 2023/11/27
 * Project: com.zking.entity in project: springboot1206
 * <p>
 * Notice: If you are using this class or file, check it and do some modification.
 */
@Data @AllArgsConstructor @NoArgsConstructor
@TableName("user2") // mybatis-plus

// @Entity + @Table(name = "user2") // 使用JPA的注解
@Entity(name = "user2") // 等同于上面
public class User {
    @TableId(type = IdType.AUTO) // mybatis-plus
    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    
    @TableField // mybatis-plus
    @Column // 表示是数据库字段，可以省略
    private String username;
    private String password;
    private Double money;
    
    // 如果设置ddl-auto=update可以自动增加字段
    /* @Column(name = "date_time", nullable = false)
    private Timestamp date1;
    @Transient // 不是一列
    private Date date2;
    @Transient
    private String date3; */
}
